{extend name="index:layout" /}

{block name="menu"}
{include file="center/menu" /}
{/block}

{php}
$header_ad[intval($webdb[header_ad])]=' checked ';
{/php}

{block name="content"}
<SCRIPT LANGUAGE="JavaScript">
<!--
function SelectType(i){
	$('#selecttype0').hide();
	$('#selecttype1').hide();
	$('#selecttype'+i).show();
}
function addType(){	
	var list1=$('#Slides').children().length; 
	var ListType1='<div class="list"><div><span>图片</span> <input name="post_db['+list1+'][pic]" type="text" id="out_url'+list1+'" placeholder="请上传图片" size="50"/><em><iframe frameborder=0  scrolling=no src="$webdb[www_url]/do/upfile.php?fn=upfile&dir=homepage&label=out_url'+list1+'"></iframe></em></div><div><span>链接</span> <input name="post_db['+list1+'][link]" type="text" size="80"/></div></div>';
	$("#Slides").append(ListType1);
	hide_desc();
}
function hide_desc(){
	$('.ListType .list').each(function(){
		//$(this).children().eq(1).hide();
	});
}
function addType1(){	
	var list1=$('#AdImages').children().length; 
	var ListType1='<div class="list"><div><span>图片</span> <input name="adimages['+list1+'][pic]" type="text" id="adimages'+list1+'" placeholder="请上传图片" size="50"/><em><iframe frameborder=0  scrolling=no src="$webdb[www_url]/do/upfile.php?fn=upfile&dir=homepage&label=adimages'+list1+'"></iframe></em></div><div><span>链接</span> <input name="adimages['+list1+'][link]" type="text" placeholder="请输入图片链接地址" size="80"/></div></div>';
	$("#AdImages").append(ListType1);
}
//-->
</SCRIPT>  
<style>
.ListType .list{border:#DDD solid 1px;border-top:0;margin:0 auto 5px auto;}
.ListType .list div{border-top:#DDD solid 1px;padding:5px 5px 5px 50px;position:relative;}
.ListType .list div span{display:block;width:45px;height:30px;line-height:30px;text-align:right;position:absolute;top:3px;left:0;}
.ListType .list div input{width:400px;border:#DDD solid 1px;height:20px;}
.ListType .list div textarea{border:#DDD solid 1px;height:100px;width:90%;} 
.ListType .list div em{display:block;width:300px;height:30px;position:absolute;left:460px;top:5px;overflow:hidden;}
.butters{border:#DDD solid 1px;background:#EFEFEF; display:inline-block;padding:3px 10px;border-radius:3px;}
</style> 


<form method="post" action="{:url('center/homepage')}">
<div class="MainContainers">
	<div class="Header"><span class="tag">主页设置</span><span class="more">&gt;&gt;</span></div>
	<div class="Conter">
		<table class="FormTable">
		  <tr>
		    <td class="tdL">商家标题：</td>
			<td class="tdR"><input name="webdbs[homepage_title]" type="text" style="width:500px;" value="{$webdb[homepage_title]}"/></td>
		  </tr>
		  <tr>
		    <td class="tdL">商家地址：</td>
			<td class="tdR"><input name="webdbs[homepage_address]" type="text" style="width:500px;" value="{$webdb[homepage_address]}"/></td>
		  </tr>
		  <tr>
		    <td class="tdL">联系电话:</td>
			<td class="tdR"><input type="text" size="25" name="webdbs[telphone]" value="{$webdb[telphone]}"></td>
		  </tr>
		  <tr>
		    <td class="tdL">客服QQ:</td>
			<td class="tdR"> <input type="text" size="25" name="webdbs[kefuQQ]" value="{$webdb[kefuQQ]}"></td>
		  </tr>
		  <tr>
		    <td class="tdL">商家主图：</td>
			<td class="tdR">
				<div style="float:left;"><input name="webdbs[homepage_banner]" id="homepage_banner" type="text" style="width:400px;" value="{$webdb[homepage_banner]}"/></div>
    			<div style="float:left;padding:3px 0 0 10px;"><iframe frameborder=0  style="height:30px;width:220px;" scrolling=no src='$webdb[www_url]/do/upfile.php?fn=upfile&dir=homepage&label=homepage_banner'></iframe> </div>
  			</td>
		  </tr>
		  <tr>
		    <td class="tdL">商家LOGO图：</td>
			<td class="tdR">
				<div style="float:left;"><input name="webdbs[homepage_logo]" id="homepage_logo" type="text" style="width:400px;" value="{$webdb[homepage_logo]}"/></div>
    			<div style="float:left;padding:3px 0 0 10px;"><iframe frameborder=0  style="height:30px;width:220px;" scrolling=no src='$webdb[www_url]/do/upfile.php?fn=upfile&dir=homepage&label=homepage_logo'></iframe> </div>
  			</td>
		  </tr>
		  <tr>
		    <td class="tdL">禁止显示产品：</td>
			<td class="tdR">
{php}
$webdb[hide_shop_info]||$webdb[hide_shop_info]=0;
$hide_shop_info[$webdb[hide_shop_info]]=' checked ';
{/php}
				<input name="webdbs[hide_shop_info]" type="radio" value="1" {$hide_shop_info[1]} /> 是
				<input type="radio" name="webdbs[hide_shop_info]" value="0" {$hide_shop_info[0]} /> 否
  			</td>
		  </tr>
		  <tr>
		    <td class="tdL">产品两列显示：</td>
			<td class="tdR">
{php}
$webdb[shop_info_list2]||$webdb[shop_info_list2]=0;
$shop_info_list2[$webdb[shop_info_list2]]=' checked ';
{/php}
				<input name="webdbs[shop_info_list2]" type="radio" value="1" {$shop_info_list2[1]} /> 是
				<input type="radio" name="webdbs[shop_info_list2]" value="0" {$shop_info_list2[0]} /> 否
			  </td>
			</tr>
		  <tr id='selecttype1'>
		    <td class="tdL">幻灯片：<img src='{$webdb[www_url]}/images/default/menu_add.gif' onClick="addType()"/></td>
			<td class="tdR">
	  <div class="butters" id="showSlides">点击修改幻灯片</div>
	  <div class="ListType" id="Slides">
{php}
$i=0;
$listdb = unserialize($webdb[homepage_rollpic]);
foreach($listdb AS $key=>$rs){
{/php}
		<div class="list">
			
			<div>
				<span>图片</span> <input name="post_db[{$i}][pic]" type="text" value="{$rs[pic]}" id='out_url{$i}' placeholder="请上传图片"/>
				<em><iframe frameborder=0  scrolling=no src='{$webdb[www_url]}/do/upfile.php?fn=upfile&dir=homepage&label=out_url{$i}'></iframe></em>			</div>
			<div><span>链接</span> <input name="post_db[{$i}][link]" type="text" value="{$rs[link]}" size="80"/>
			</div>
		</div>
{php}
$i++;
}if($i<1){
{/php}
		<div class="list">
			
			<div>
				<span>图片</span> <input name="post_db[0][pic]" type="text" id='out_url0' placeholder="请上传图片"/>
				<em><iframe frameborder=0  scrolling=no src='{$webdb[www_url]}/do/upfile.php?fn=upfile&dir=homepage&label=out_url0'></iframe></em>			</div>
			<div><span>链接</span> <input name="post_db[0][link]" type="text" placeholder="请输入图片链接地址"/>
			</div>
		</div>
{php}
}if($i>1){
{/php}
<SCRIPT LANGUAGE="JavaScript">
<!--
hide_desc();
//-->
</SCRIPT> 
{php}
}
{/php}
	  </div>  </td>
</tr>
<tr>
		    <td class="tdL">广告图片：<img src='{$webdb[www_url]}/images/default/menu_add.gif' onClick="addType1()"/></td>
			<td class="tdR">
  	  <div class="butters" id="showAdImages">点击修改广告图片</div>
	  <div class="ListType" id="AdImages">
{php}
$i=0;
$listdb = unserialize($webdb['homepage_adimages']);
foreach($listdb AS $key=>$rs){
{/php}
		<div class="list">
			
			<div>
				<span>图片</span> <input name="adimages[{$i}][pic]" type="text" value="{$rs[pic]}" id='adimages{$i}' placeholder="请上传图片"/>
				<em><iframe frameborder=0  scrolling=no src='{$webdb[www_url]}/do/upfile.php?fn=upfile&dir=homepage&label=adimages{$i}'></iframe></em>			</div>
			<div><span>链接</span> <input name="adimages[{$i}][link]" type="text" value="{$rs[link]}" size="80"/>
			</div>
		</div>
{php}
$i++;
}if($i<1){
{/php}
		<div class="list">
			
			<div>
				<span>图片</span> <input name="adimages[0][pic]" type="text" id='adimages0' placeholder="请上传图片"/>
				<em><iframe frameborder=0  scrolling=no src='{$webdb[www_url]}/do/upfile.php?fn=upfile&dir=homepage&label=adimages0'></iframe></em>			</div>
			<div><span>链接</span> <input name="adimages[0][link]" type="text" placeholder="请输入图片链接地址"/>
			</div>
		</div>
{php}
}
{/php}
	  </div>
  </td>
</tr>

<tr >
		    <td class="tdL">头部菜单：</td>
			<td class="tdR">
  	  <div class="butters" id="showTopMenus">点击修改头部菜单</div>
	  <div class="ListType" id="TopMenus">
{php}
$menuTop = unserialize($webdb['homepage_menuTop']);
for($i=0;$i<4;$i++){
{/php}
		<div class="list">
		
		<div><span>标题</span> <input name="menu_top[{$i}][title]" value="{$menuTop[$i][title]}" type="text" style="width:100px;" maxlength="8" /> 
		链接<input name="menu_top[{$i}][link]" type="text" value="{$menuTop[$i][link]}" size="50"/> </div>
			
			 
			
			<div>
				<span>图标</span> <input name="menu_top[{$i}][pic]" type="text" value="{$menuTop[$i][pic]}" id='menu_top$i' placeholder="请上传图片"/>
				<em><iframe frameborder=0  scrolling=no src='{$webdb[www_url]}/do/upfile.php?fn=upfile&dir=homepage&label=menu_top{$i}'></iframe></em>			</div>
			
			
		</div>
{php}
} 
{/php}
 
 
	  </div>  
	  		</td>
		  </tr>
		  <tr>
		    <td class="tdL">底部菜单：</td>
			<td class="tdR">
		<div class="butters" id="showFootMenus">点击修改底部菜单</div>
	  <div class="ListType" id="FootMenus">
{php}
$menuFoot = @unserialize($webdb['homepage_menuFoot']);
for($i=0;$i<4;$i++){
{/php}
		<div class="list">
		
		<div><span>标题</span> <input name="menu_foot[{$i}][title]" value="{$menuFoot[$i][title]}" type="text" style="width:100px;" maxlength="8" /> 
		链接<input name="menu_foot[{$i}][link]" type="text" value="{$menuFoot[$i][link]}" size="50"/> </div>
			
			 
			
			<div>
				<span>图标</span> <input name="menu_foot[{$i}][pic]" type="text" value="{$menuFoot[$i][pic]}" id='menu_foot{$i}' placeholder="请上传图片"/>
				<em><iframe frameborder=0  scrolling=no src='{$webdb[www_url]}/do/upfile.php?fn=upfile&dir=homepage&label=menu_foot{$i}'></iframe></em>			</div>
			
			
		</div>
{php}
} 
{/php}
 
 
	  </div>
	  		</td>
		  </tr>
		  <tr>
		    <td class="tdL">商家介绍:</td>
			<td class="tdR"><textarea name="webdbs[about]" cols="80" rows="8">{$webdb[about]}</textarea></td>
		  </tr>
		  <tr>
		    <td class="tdL">页面头部广告条:</td>
			<td class="tdR">
       		 	<input type="radio" name="webdbs[header_ad]" value="1" {$header_ad[1]}> 启用
				<input type="radio" name="webdbs[header_ad]" value="0" {$header_ad[0]}> 禁用
         	</td>
		  </tr>
		  <tr>
		    <td class="tdL">广告描述:</td>
			<td class="tdR"><input type="text" size="50" name="webdbs[header_adDsc]" value="{$webdb[header_adDsc]}" /></td>
		  </tr>
		  <tr>
		    <td class="tdL">广告按钮文字:</td>
			<td class="tdR"><input type="text" size="20" name="webdbs[header_adSub]" value="{$webdb[header_adSub]}" /></td>
		  </tr>
		  <tr>
		    <td class="tdL">广告链接：</td>
			<td class="tdR"><input type="text" size="50" name="webdbs[header_adUrl]" value="{$webdb[header_adUrl]}" /></td>
			</tr>
		  </table>
		<div class="submits">
		<input type="hidden" name="type" size="5" value="homepage">
		<input type="button" onclick="window.open('{$webdb[www_url]}/shop/wapindex.php')" name="Submit2" value="预览" /> <input type="submit" name="Submit2" value="提交" /> <input name="id" type="hidden" id="id" value="{$id}" /></div>
	</div>
</div>
</form>
<style>
.cut_imgBox{
	position:absolute;
	width:80%;
	height:90%;
	left:10%;
	top:5%;
	background:#FFF;
	z-index:100000;
	border:#DDD solid 1px;
	display:none;	
}
.cut_imgBox .close{
	width:100px;
	height:35px;
	text-align:center;
	line-height:35px;
	border:#F30 solid 1px;
	background:#F60;
	color:#FFF;
	position:absolute;
	right:10px;
	top:10px;
}
</style>
<div class="cut_imgBox">
	<iframe frameborder="0" src="http://www.qibosoft.com" scrolling="yes" style="height: 100%; visibility: inherit; width: 100%; z-index: 1;overflow: auto;"></iframe>
	<div class="close" onclick="hide_cutimg();">不剪切当前图片</div>
</div>



<script>
function upfile(url,name,size,ty){
	document.getElementById(ty).value=url;
	$('.cut_imgBox').fadeIn();
	$('.cut_imgBox iframe').attr("src","/cutimg/cutimg.php?cutimg="+url+"&"+Math.random());
}
function hide_cutimg(){
	$('.cut_imgBox').fadeOut();
	$('.cut_imgBox iframe').attr("src",'');
}
$('#Slides').css('display','none');
$('#TopMenus').css('display','none');
$('#FootMenus').css('display','none');
$('#AdImages').css('display','none');

$('#showSlides').click(function(){
	$('#Slides').css('display','block');
	$('#showTopMenus').css('display','inline-block');
	$('#showFootMenus').css('display','inline-block');
	$('#showAdImages').css('display','inline-block');
	$('#AdImages').css('display','none');
	
	$('#TopMenus').css('display','none');
	$('#FootMenus').css('display','none');
	$(this).css('display','none');
});

$('#showTopMenus').click(function(){
	$('#TopMenus').css('display','block');
	$('#showFootMenus').css('display','inline-block');
	$('#showSlides').css('display','inline-block');
	$('#showAdImages').css('display','inline-block');
	$('#AdImages').css('display','none');
	
	$('#Slides').css('display','none');
	$('#FootMenus').css('display','none');
	$(this).css('display','none');
});

$('#showFootMenus').click(function(){
	$('#FootMenus').css('display','block');
	$('#showTopMenus').css('display','inline-block');
	$('#showSlides').css('display','inline-block');
	$('#showAdImages').css('display','inline-block');
	$('#AdImages').css('display','none');
	
	$('#Slides').css('display','none');
	$('#TopMenus').css('display','none');
	$(this).css('display','none');
});

$('#showAdImages').click(function(){
	$('#AdImages').css('display','block');
	$('#showTopMenus').css('display','inline-block');
	$('#showSlides').css('display','inline-block');
	$('#showFootMenus').css('display','inline-block');
	
	$('#Slides').css('display','none');
	$('#TopMenus').css('display','none');
	$('#FootMenus').css('display','none');
	$(this).css('display','none');
});
</script>

{/block}